﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using QLTV_Public;

namespace QLTV_Data
{
   public class PhieuMuon_Data
    {
       KetNoiCSDL_Data kn = new KetNoiCSDL_Data();
       public DataTable LayDuLieu()
       {
           return kn.LayDuLieu("Load_tbl_PhieuMuon");
       }
       public DataTable Load_tbl_PhieuMuon_MuonSach()
       {
           return kn.LayDuLieu("Load_tbl_PhieuMuon_MuonSach");
       }
       public DataTable Load_DKMuonSach()
       {
           return kn.LayDuLieu("Load_DangKyMuonSach");
       }
       public int Insert_PhieuMuon(PhieuMuon_Public maDocGia,PhieuMuon_Public kieuMuon,PhieuMuon_Public ngayLap)
       {
           int Nparameter = 3;
           string[]name=new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@MaDocGia";
           value[0] = maDocGia.MaDocGia;
           name[1] = "@KieuMuon";
           value[1] = kieuMuon.KieuMuon;
           name[2] = "@NgayLap";
           value[2]=ngayLap.NgayLap;
           return kn.update("Insert_PhieuMuon",name,value,Nparameter);
       }
       public int Update_PhieuMuon(PhieuMuon_Public maPhieuMuon,PhieuMuon_Public maDocGia, PhieuMuon_Public kieuMuon, PhieuMuon_Public ngayLap)
       {
           int Nparameter = 4;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@MaPhieuMuon";
           value[0] = maPhieuMuon.MaPhieuMuon;
           name[1] = "@MaDocGia";
           value[1] = maDocGia.MaDocGia;
           name[2] = "@KieuMuon";
           value[2] = kieuMuon.KieuMuon;
           name[3] = "@NgayLap";
           value[3] = ngayLap.NgayLap;
           return kn.update("Update_PhieuMuon", name, value, Nparameter);
       }
       public int Delete_PhieuMuon(PhieuMuon_Public maPhieuMuon)
       {
           int Nparameter = 1;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@MaPhieuMuon";
           value[0] = maPhieuMuon.MaPhieuMuon;
           return kn.update("Delete_PhieuMuon", name, value, Nparameter);
       }
       public int Update_PhieuMuon_MuonTra(PhieuMuon_Public maphieuMuon, PhieuMuon_Public trangThai)
       {
           int Nparameter = 1;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@MaPhieuMuon";
           value[0] = maphieuMuon.MaPhieuMuon;
           return kn.update("Update_tbl_PhieuMuon_MuonTra", name, value, Nparameter);
       }
    }
}
